package com.czk.java;

import org.apache.spark.SparkConf;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/12/14 10:46
 */
public class JavaSaprkUDAF {
    public static void main(String[] args) {
        //  创建SparkSQL的运行环境
        SparkConf sparkConf = new SparkConf().setMaster("spark://localhost:7077").setAppName("sparkSQL");
        SparkSession sparkSession = SparkSession.builder().config(sparkConf).getOrCreate();

        Dataset<Row> ds = sparkSession.read().json("F:\\IdeaProjects\\bigData\\spark\\src\\main\\resources\\data\\user.json");
        // 创建临时表
        ds.createOrReplaceTempView("user");


    }
}

class Buff {
    private Long total;
    private Long count;

    public Buff(Long total, Long count) {
        this.total = total;
        this.count = count;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }
}

class MyAvgUdf {


}
